﻿CREATE TABLE [dbo].[AdvanceRequest] (
    [Id]                      UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL,
    [RefNumber]               NVARCHAR (50)    NOT NULL,
    [AdvanceType]             NVARCHAR (MAX)   NOT NULL,
    [RequestDate]             DATE             NOT NULL,
    [PaymentTermId]           UNIQUEIDENTIFIER NOT NULL,
    [PaymentTypeId]           UNIQUEIDENTIFIER NOT NULL,
    [PaidTo]                  UNIQUEIDENTIFIER NOT NULL,
    [TotalAdvance]            MONEY            NOT NULL,
    [CurrencyId]              UNIQUEIDENTIFIER NOT NULL,
    [Subject]                 NVARCHAR (250)   NULL,
    [Remarks]                 NTEXT            NULL,
    [MBCurrency]              UNIQUEIDENTIFIER NULL,
    [MBTotal]                 MONEY            NULL,
    [VoucherNo]               NVARCHAR (50)    NULL,
    [AccountNo]               NVARCHAR (50)    NULL,
    [PreparedBy]              UNIQUEIDENTIFIER NOT NULL,
    [ReviewedBy]              UNIQUEIDENTIFIER NULL,
    [AuthorizedBy]            UNIQUEIDENTIFIER NULL,
    [PurchaseOrderId]         UNIQUEIDENTIFIER NULL,
    [BidsAttached]            BIT              NULL,
    [TravelAuthorizationId]   UNIQUEIDENTIFIER NULL,
    [CountryProgrammeId]      UNIQUEIDENTIFIER NULL,
    [RequestFor]              NVARCHAR (50)    NULL,
    [TravelType]              NVARCHAR (50)    NULL,
    [Destinations]            NVARCHAR (450)   NULL,
    [StartDate]               DATETIME         NULL,
    [EndDate]                 DATETIME         NULL,
    [PreparedOn]              DATETIME         NULL,
    [ReviewedOn]              DATETIME         NULL,
    [AuthorizedOn]            DATETIME         NULL,
    [RejectReviewRemarks]     NVARCHAR (350)   NULL,
    [RejectAuthorizedRemarks] NVARCHAR (250)   NULL,
    [IsReviewed]              BIT              NULL,
    [IsAuthorized]            BIT              NULL,
    [OrderRequestId]          UNIQUEIDENTIFIER NULL,
    [TenderAnalysisId]        UNIQUEIDENTIFIER NULL,
    [GoodsReceivedId]         UNIQUEIDENTIFIER NULL,
    [AnyOtherDoc]             BIT              NULL,
    [DocumentDames]           NVARCHAR (850)   NULL,
    [DocumentCode]            NVARCHAR (350)   NULL,
    [RecordCount]             BIGINT           IDENTITY (1, 1) NOT NULL
);

